package com.twu.biblioteca;

import java.io.PrintStream;
import java.util.ArrayList;

/**
 * Created by IntelliJ IDEA.
 * User: anubhav
 * Date: 1/7/14
 * Time: 8:01 PM
 * To change this template use File | Settings | File Templates.
 */
public class MovieListGenerator implements Action {

    private ArrayList<Movie> movieList;
    private PrintStream out;

    public MovieListGenerator(ArrayList<Movie> list, PrintStream out) {
        movieList = list;
        this.out = out;
    }

    @Override
    public void executeAction() {
        Movie mov;
        out.println("S.no.  MovieName(Director,Year,Rating)");
        for (int i = 0; i < movieList.size(); i++) {
            mov = movieList.get(i);
            out.println(i + 1 + ". " + mov.getName() + "(" + mov.getDirector()
                    + "," + mov.getYear() + "," + mov.getRating()+")");
        }
    }
}
